package com.commons.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResultFul {
    private Object data;
    private Boolean flag;
    private String message;

    public ResultFul(Boolean flag, String message) {
        this.flag = flag;
        this.message = message;
    }



    /**
     * 成功返回数据
     * @param data
     * @param message
     * @return
     */
    public static ResultFul success(Object data,String message){
        return new ResultFul(data,true,message);
    }

    /**
     *  返回结果失败
     * @param message
     * @return
     */
    public static ResultFul fail(String message){
        return new ResultFul(false,message);
    }
}
